package com.sias.bean;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author 吴文杰
 * @version 1.0
 * @since 2023/5/31 16:56
 */
@Component
public class LifeCycleBean {
  private static final Logger LOG = LoggerFactory.getLogger(LifeCycleBean.class);

  public LifeCycleBean() {
    LOG.debug("构造");
  }

  @Autowired
  public void autowire(@Value("${JAVA_HOME}") String name){
    LOG.debug("依赖注入{}",name);
  }

  @PostConstruct
  public void init() {
    LOG.debug("初始化");
  }

  @PreDestroy
  public void destroy() {
    LOG.debug("销毁");
  }

}
